# -*- encoding: utf-8 -*-
'''
@File		:	dingding.py
@Time		:	2024/01/18 16:44:56
@Author		:	dan
@Description:	matter 示例代码，测试钉钉登录功能
'''


if __name__ == '__main__':
    import sys
    sys.path.append(".")
import matter
import matter.android

## package_name = com.alibaba.android.rimet

@matter.test_case(name='登录')
def login():
    # 输入账号
    if matter.android.exist_id('ic_edit_phone'):
        matter.android.touch_by_id('ic_edit_phone')
    else:
        matter.android.touch_by_id('et_phone_input')
        matter.android.input('13434818363')

        # 输入密码
        matter.android.touch_by_id('et_password')
        matter.android.input('dwdyoung0219')

        # 勾选同意
        matter.android.touch_by_id('login_pwd_rl')

        # 点击登录
        matter.android.touch_by_id('tv')

    ## 判断是否登录成功
    logined = matter.android.exist_image(image_path='tests/matter/android/dingding/login_success.png')
    matter.assert_true(logined)


if __name__ == '__main__':
    matter.start(yml='demo/matter/android/dingding/dingding.yml')